Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <body> <select size="6"> <option value="BMW">BMW</option> <option value="Mercedes">Mercedes</option> <optgroup id="myOptgroup" label="Swedish Cars"> <option value="volvo">Volvo</option> <option value="saab">Saab</option> <option value="koenigsegg">Koenigsegg</option> </optgroup> </select> <p>Click the button to change the value of the label attribute of the option-group.</p> <button onclick="myFunction()">Try it</button> <script> function myFunction() { document.getElementById("myOptgroup").label = "A Random Car Selection"; } </script> </body> <!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_optgroup_label2 by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:34:40 GMT --> </html>
Result:
Try it Yourself - © w3schools.com